
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Connection"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>InsertAdmin</title>
    </head>
    <body>
        <%
            Connection con = null;
            String idPanganBefore = request.getParameter("idPangan");
            String idPangan = request.getParameter("idPanganInput");
            String namaPangan = request.getParameter("namaPanganInput");
            String beratPangan = request.getParameter("beratPanganInput");
            String urtPangan = request.getParameter("urtPanganInput");
            String kaloriPangan = request.getParameter("kaloriPanganInput");

            Double kaloriD = Double.valueOf(kaloriPangan);
            String karboPangan = request.getParameter("karboPanganInput");
            Double karboD = Double.valueOf(karboPangan);
            String proteinPangan = request.getParameter("proteinPanganInput");
            Double proteinD = Double.valueOf(proteinPangan);
            String lemakPangan = request.getParameter("lemakPanganInput");
            Double lemakD = Double.valueOf(lemakPangan);
            String idKategoriPangan = request.getParameter("idKategoriPanganInput");

            String queryText = ("UPDATE  PANGAN "
                    + "SET namaPangan='" + namaPangan + "' , beratPangan='" + beratPangan + "' ,urtPangan='" + urtPangan + "' ,kaloriPangan="
                    + kaloriD + " ,karboPangan=" + karboD + " , proteinPangan=" + proteinD + " ,"
                    + "lemakPangan=" + lemakD + ""
                    + " WHERE idPangan='" + idPanganBefore + "'");
            try {
                Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();

                 //con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "MHS115314078", "mhs115314078");
               //  con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "hr", "hr");

                // con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "MHS115314078", "mhs115314078");
        con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "hr", "renia");

                Statement stat = con.createStatement();
                ResultSet rst = stat.executeQuery(queryText);
                rst.close();
                stat.close();
                con.close();
                response.sendRedirect("KamusGiziAdministrator.jsp");
            } catch (Exception e) {
                out.println("Error.." + e);
            }




        %>

    </body>
</html>
